package dao.impl;

import dao.NewsDao;
import dao.NewsService;
import factory.SimpleDaoFactory;
import pojo.News;

public class NewsServiceImpl implements NewsService {
//    private NewsDao dao = SimpleDaoFactory.getInstance();
//    public void addNews(News news) {
//        dao.save(news);
//    }

    private NewsDao dao;

    public NewsDao getDao() {
        return dao;
    }

    public void setDao(NewsDao dao){
        this.dao = dao;
    }
    public void addNews(News news) {
        dao.save(news);
    }

    NewsDao newsDao = new NewsDaoImpl();
    @Override
    public void save(News news) {
        newsDao.save(news);
    }
}
